<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script crossorigin src="https://unpkg.com/react@17/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
<!--    用于解析ES6-->
    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
    <style>
        .red {
            color: red;
        }
    </style>
</head>
<!--ES6 -->
<body>
    <div id="app"></div>
    <script type="text/babel">
        function tick(){
            let time = new Date().toLocaleTimeString()
            // 写多个元素，必须要有根元素
            let template = <div>
                <h2 className="red">hello demo4</h2>
                <p>现在是： {time}</p>
            </div>
            ReactDOM.render(template,document.getElementById('app'))
        }
        // 调用方法展示
        //tick() // 此时展示的时间还是静态的，并不能更新
        // 使用定时器更新
        setInterval(tick,1000)
    </script>
</body>
</html>